package com.zzyl.common.ai;

import com.baidubce.qianfan.Qianfan;
import com.baidubce.qianfan.model.chat.ChatResponse;
import org.apache.poi.xddf.usermodel.chart.RadarStyle;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

/**
 * ai
 *
 * @Author wd
 * @Date 2025/5/20 15:01
 */
@Component
public class AiInvoker {

    @Value("ERNIE-4.0-8K")
    private String model;

    @Value("0.7")
    private String temperature;

    public String invokeQianFanChat(String prompt){

        ChatResponse response = new Qianfan().chatCompletion()
                .model(model)
                .addMessage("user",prompt)
                .temperature(Double.valueOf(temperature))
                .responseFormat("json_object")
                .execute();
        return response.getResult();

    }






}
